import json
import pinyin


def getStrAllAplha(str):
    return pinyin.get_initial(str, delimiter="")


if __name__ == '__main__':
    # 不同的题型使用不同的策略
    with open('database.json', 'r') as f:
        database = json.loads(f.read())
    print(f"读取完成!共有{len(database)}条记录")
    while True:
        in_str = input().split(" ")
        word = in_str[0]
        head = None
        if len(in_str) > 1:
            head = in_str[1]
        for k in database.keys():
            for item in database[k]:
                sx_a = getStrAllAplha(word)
                if word in getStrAllAplha(item['content']['mean']) and head is None:
                    print(f"{k}\n$$$$\nz{item['content']['mean']}")
                for item1 in item['content']['usage']:
                    # 检查是否有在内部的
                    if word in "".join(filter(str.isalpha, getStrAllAplha(item1))):  # 使用拼音首字母比对
                        if head is not None:
                            if head in item1:
                                print(f"{item1}")
                        else:
                            print(f"{item1}")
        print("\n\n\n\n")
